package com.wffz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wffz.comm.utils.CommUtils;
import com.wffz.mapper.TaskConfigMapper;
import com.wffz.po.TaskConfig;
import com.wffz.service.TaskConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author sunlei
 * @className TaskConfigServiceImpl
 * @Description
 * @date 2023-02-17 13:41
 **/
@Service
public class TaskConfigServiceImpl implements TaskConfigService {

    @Resource
    private TaskConfigMapper taskConfigMapper;

    @Override
    public TaskConfig getTaskConfigByName(String taskName) {
        QueryWrapper<TaskConfig> wrapper = new QueryWrapper<>();
        wrapper.eq("task_name", taskName);
        List<TaskConfig> list = taskConfigMapper.selectList(wrapper);
        if (CommUtils.isNotEmptyList(list)) {
            return list.get(0);
        } else {
            return null;
        }
    }
}
